<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
      ul li {
          list-style: none;
          display: inline-block;
          width: 100px;
          border: 1px solid #000;
          background-color: aqua;
          text-align: center;
      }

      ul li.active {
          background-color: gold;
      }
  </style>
</head>
<body>
  <div id="app">
      <ul>
          <li v-for="(item,index) of pics" @click="changeIndex(index)" :class='currentIndex == index? "active": ""'>{{item.title}}</li>
      </ul>
      <div v-for="(item,index) of pics">
          <img :src="item.imgSrc" alt="" v-show="currentIndex == index">
      </div>
  </div>
  <script src="./vue.js"></script>
  <script>
    var vm = new Vue({
      el:'#app',
      data:{
          currentIndex:0,
          pics: [
              {title:'img1',imgSrc:'./img/1.png'},
              {title:'img2',imgSrc:'./img/2.png'},
              {title:'img3',imgSrc:'./img/3.png'},
              {title:'img4',imgSrc:'./img/4.png'},
          ],

      },
      methods:{
          changeIndex(i) {
            this.currentIndex = i
          }
      }
     });
  </script>
</body>
</html>
